﻿<?php
    @session_start();
    include("template/head.php");
	if($user['account_login']=="user"){
		header('location:list_article.php?action=access_denied');
	}
    $sql = "SELECT * FROM `st_article`,`st_entree` WHERE `st_article`.id_article = `st_entree`.id_article";
	$obj = new Mysql ();
	$result = mysql_query($sql);
?>

<style type="text/css">
    #example_filter label input{
        height: 27px;
    }
</style>

    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                
		 <?php
                if ((isset($_GET["action"])) && ($_GET["action"] == "deleted"))
                {
                echo'
                <div class="alert alert-success span8" style="margin:10px;">
                    L\'entrée de stock est supprimer avec succès <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
				if ((isset($_GET["action"])) && ($_GET["action"] == "added"))
                {
                echo'
                <div class="alert alert-success span8" style="margin:10px;">
                    L\'entrée de stock est enregistrée avec succès <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
                if ((isset($_GET["action"])) && ($_GET["action"] == "updated"))
                {
                echo'
                <div class="alert alert-success span8" style="margin:10px;">
                    Mise à jour de L\'entrée de stock est effectuée avec succès. <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
				if ((isset($_GET["action"])) && ($_GET["action"] == "addedError"))
                {
                echo'
                <div class="alert alert-danger span8" style="margin:10px;">
                    L\'entrée de stock n\'est pas enregistrer. ressayer plus tard. <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }

            ?> 
        <div class="span10" id="content">
            <div class="row-fluid">
            <!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Liste des Entrées des Articles (<?php  $num = mysql_num_rows($result); echo $num ; ?>)</div>
              	<div class="pull-right"><a class="btn btn-primary btn-sm" href="add_entree.php?page=list_entree" style="float:right;width:200px;margin-bottom:20px;" >Ajouter une opération d'achat</a></div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
                    <thead>
                      <tr>
				        <th>Réf. Article</th>
				        <th>Qté en Stock</th>
						<th>Désignation</th>
                        <th></th>
                      </tr>
                    </thead>
                    <tbody>
                       <?php while($row = mysql_fetch_object($result)){?>
                       	        
                      	<tr class="odd gradeX">
                        <td>
				            <?php 
				                $rq = "select * from st_article where ref_article = '".getRefArticle($row->id_article)."'";
				                $res = mysql_query($rq);
				                while($rowPhoto = mysql_fetch_object($res)){
				                    echo '
				                    <a class="fancybox-effects-a" href="'.$rowPhoto->photo_name.'">
				                    	'.$row->ref_article.'
				                    </a>';
				                }
				            ?>
				        </td>
				        <td class="center" style="color:#d0343a;text-align:center;"><?php echo number_format($row->Quantite, 0, '', ' ') ?></td>
						 <td><?php echo nl2br($row->designation) ?></td>
						<!--<td><?php echo getTypemonnaie($row->id_devise)?></td>-->
						<!--<td><?php echo getUser($row->last_user_modif) ?></td>-->
                        <td>
                             <a href="view_list_entree_for_product.php?page=list_entree&id_article=<?php echo $row->id_article?>" class="btn btn-small" style="margin-right:20px;">Détails</a>      
                        </td>
                      </tr>
                      <?php
                        }
                      ?>
                    </tbody>
                  </table>
                </div>
                <a class="btn btn-primary btn-sm" href="add_entree.php?page=list_entree" style="float:right;width:200px;margin:20px;" >Ajouter une opération d'achat</a>
              </div>
            </div>
        <!-- /block -->
          </div>
                </div>
            </div>
            <hr>
        </div>
<?php  include("template/footer.php") ; ?>